<template>
  <div>
    <TopFilter ref="topFilter" :list="topFilterList" :cols="3" labelWidth="110" @filterChange="changeHandle" @onCollapse="collapseHandle"></TopFilter>

    <button-area :style="{ paddingLeft: '80px' }"></button-area>
    <FilterTable
      ref="table"
      columnsRef="testindex"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :isSelectColumn="false"
      :datakey="'records'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="selectData"
    >
    </FilterTable>
    123
  </div>
</template>

 <script>
import { getGradeData } from '@/api/assessgrade/grade/lowscore';
export default {
  name: 'lowscoreindex',
  data() {
    return {
      topFilterList: this.createTopFilterList(),
      columns: this.createTableColumns(),
      fetchParams: { xhrAbort: true },
      fetchApi: getGradeData,
    }
  },
  methods: {
    createTopFilterList() {
      return [
        {
          type: 'INPUT',
          label: '评价单号',
          fieldName: 'afpjid'
        },
        {
          type: 'INPUT',
          label: '评价场景',
          fieldName: 'afpjcj'
        },
        {
          type: 'INPUT',
          label: '评价机构名称',
          fieldName: 'afjgmc'
        },
        // {
        //   type: 'INPUT',
        //   label: '业务范围',
        //   fieldName: 'va4'
        // },
        {
          type: 'INPUT',
          label: '评价人',
          fieldName: 'afpjry'
        },
        {
          type: 'INPUT',
          label: '评价对象',
          fieldName: 'afpjdx'
        },
      ]
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '评价单号',
          dataIndex: 'afpjid',
          sorter: true,
        },
        {
          title: '评价场景',
          dataIndex: 'afpjcj',
          sorter: true,
        },
        {
          title: '评价对象机构',
          dataIndex: 'afjgmc',
          sorter: true,
        },
        {
          title: '评价对象人',
          dataIndex: 'afpjdx',
          sorter: true,
        },
        {
          title: '评价分数',
          dataIndex: 'afpjfs',
          sorter: true,
        },
        {
          title: '评价人',
          dataIndex: 'afpjry',
          sorter: true,
        },
        {
          title: '评价人电话',
          dataIndex: 'afpjdh',
          sorter: true,
        },
        {
          title: '评价日期',
          dataIndex: 'afpjrq',
          sorter: true,
        },
      ]
    },
    changeHandle(val) {
      this.fetchParams = Object.assign({}, val);
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.BaseTable.EXECUTE_RESET_HEIGHT();
      });
    },
    selectData(val) {
      console.info(val)
      this.tableData = val;
    }
  }
}
</script>